'''
Created on 2012-4-9

@author: Administrator
'''

from popcan.helper.loggerhelper import QueueLogger,Module

class PatchRequestMiddleware(object):
    
    def process_request(self,request):
        affix = getattr(request,'affix',False)
        if not affix:
            request.affix = {}
            
class LogRequestMiddleware(object):
    
    def process_request(self,request):
        url = request.META.get('PATH_INFO',None)
        ip = request.META.get('REMOTE_ADDR',None)
        if url and ip:
            QueueLogger().info(Module.Request, 'url=%s ip=%s' % (url,ip))
            